import React, { useState, useEffect } from 'react'
import style from './Index.module.less'
import { Button } from 'antd'
import { confirmAction } from '@js/tool'

async function requestHandle () {

}

function Main ({ data }) {
  const [config, setConfig] = useState({})
  useEffect(() => {
    if (data && data.typeconfig) {
      setConfig(data.typeconfig)
    }
  }, [data])
  return (
    <div className={style.container}>
      <Button type='primary' onClick={() => confirmAction(config.notice || `您确定要 ${data.title} 吗？`, () => requestHandle(data.value))}>{data.title}</Button>
    </div>
  )
}

export default Main
